home *** CD-ROM | disk | FTP | other *** search
/ Gigarom 1 / Gigarom Macintosh Archives (Quantum Leap)(CDRM1080320)(1993).iso / FILES / HYP / J-M / MH Power Scripts v1.3.cpt / MH Power Scripts v1.3 / card_2150.txt < prev    next >
Text File  |  1989-02-26  |  10KB  |  350 lines

  1. -- card: 2150 from stack: in.3
  2. -- bmap block id: 0
  3. -- flags: 4000
  4. -- background id: 2663
  5. -- name: Item Select
  6.  
  7.  
  8. -- part 1 (field)
  9. -- low flags: 01
  10. -- high flags: 4007
  11. -- rect: left=280 top=82 right=241 bottom=500
  12. -- title width / last selected line: 0
  13. -- icon id / first selected line: 0 / 0
  14. -- text alignment: 0
  15. -- font id: 4
  16. -- text size: 9
  17. -- style flags: 0
  18. -- line height: 14
  19. -- part name: Item Select
  20. ----- HyperTalk script -----
  21. on copyright
  22.   -- Item Select, Copyright by Mac Help Co., January 1988
  23.   -- by Chris Hostetter, Mac Help Co., 1800 East Market Street
  24.   -- Long Beach, CA  90805, (213) 428-7414
  25.   --      The script for this field is copyrighted and may not be
  26.   --      used without the written permission of the author (above).
  27. end copyright
  28.  
  29.  
  30. on mouseUp
  31.   Global ThisItem, ThisLine, ThisField
  32.  
  33.   --  NOTE: THIS BUTTON CAN ALSO USE A HILITER BUTTON.  SIMPLY CREATE
  34.   -- A NEW BUTTON ON THE SAME CARD OR BACKGROUND THAT THIS FIELD IS ON.
  35.   -- NAME THE BUTTON 'HILIGHTER' AND SET THE BUTTON TO TRANSPARENT
  36.   -- put false into UseHilighter (below) if you don't want a hilighter
  37.  
  38.   put TRUE into UseHilighter
  39.  
  40.   set numberformat to 0
  41.   put the clickLoc into ThisMouseLoc
  42.   set cursor to 4
  43.  
  44.   put the name of the target into WhatField
  45.   put word 1 of WhatField into StackLocation
  46.   put the rect of whatField into FieldRect
  47.   put item 1 of FieldRect into X   -- Left of Rect
  48.   put item 2 of FieldRect into Y   -- Top of Rect
  49.   put item 3 of FieldRect into XX  -- Right of Rect
  50.   put item 4 of FieldRect into YY  -- Bottom of Rect
  51.  
  52.   put (YY - Y) / the textheight of whatField into TotalZones
  53.   put (YY - Y) / TotalZones into ZoneDepth
  54.   put item 2 of ThisMouseLoc - Y into MouseDepth
  55.   put the trunc of ((MouseDepth / ZoneDepth) + 1) into whichZone
  56.  
  57.   put the scroll of whatField / the textHeight of whatField into HiddenLines
  58.   put the round of HiddenLines into HiddenLines
  59.   put whichZone + HiddenLines into ThisLine
  60.   do "put line" && ThisLine && "of" && whatField && "into ThisItem"
  61.  
  62.  
  63.   if UseHilighter is true then
  64.     --MOVE HILIGHTER BUTTON TO PROPER ZONE
  65.     put Y + ((whichZone-1)*ZoneDepth) into ButY
  66.     put the trunc of ButY into ButY
  67.     put the trunc of (ButY+ZoneDepth) into ButYY
  68.     if StackLocation is "Card" then
  69.       if the style of whatField is "Scrolling" then
  70.         set the rect of Card button "Hilighter" to X+1,ButY+1,XX-17,ButYY-1
  71.       else
  72.         set the rect of Card button "Hilighter" to X+1,ButY+1,XX-1,ButYY-1
  73.       end if
  74.       set the hilite of Card button "Hilighter" to true
  75.       show Card button "Hilighter"
  76.       Hide Card button "Hilighter"
  77.     else
  78.       if the style of whatField is "Scrolling" then
  79.         set the rect of background button "Hilighter" to X+1,ButY+1,XX-17,ButYY-1
  80.       else
  81.         set the rect of background button "Hilighter" to X+1,ButY+1,XX-1,ButYY-1
  82.       end if
  83.       set the hilite of background button "Hilighter" to true
  84.       show background button "Hilighter"
  85.       Hide background button "Hilighter"
  86.     end if
  87.   end if
  88.  
  89.   -- **************************************************
  90.   -- The information is in the variable 'ThisItem'
  91.   ask "This is what you selected:" with ThisItem
  92.   -- **************************************************
  93.  
  94. end mouseUp
  95.  
  96.  
  97.  
  98. -- part 2 (button)
  99. -- low flags: 00
  100. -- high flags: 8005
  101. -- rect: left=280 top=245 right=267 bottom=488
  102. -- title width / last selected line: 0
  103. -- icon id / first selected line: 0 / 0
  104. -- text alignment: 1
  105. -- font id: 0
  106. -- text size: 12
  107. -- style flags: 0
  108. -- line height: 16
  109. -- part name: SHOW the Hilighter Button
  110. ----- HyperTalk script -----
  111. on mouseUp
  112.   put the name of the target into ThisName
  113.   if the visible of card button "Hilighter" is true then
  114.     hide card button "Hilighter"
  115.     set the name of ThisName to "SHOW the Hilighter Button"
  116.   else
  117.     show card button "Hilighter"
  118.     set the name of ThisName to "HIDE the Hilighter Button"
  119.   end if
  120.  
  121. end mouseUp
  122.  
  123.  
  124.  
  125. -- part 3 (button)
  126. -- low flags: 80
  127. -- high flags: 4000
  128. -- rect: left=281 top=83 right=95 bottom=483
  129. -- title width / last selected line: 0
  130. -- icon id / first selected line: 0 / 0
  131. -- text alignment: 1
  132. -- font id: 0
  133. -- text size: 12
  134. -- style flags: 0
  135. -- line height: 16
  136. -- part name: Hilighter
  137.  
  138.  
  139. -- part 4 (button)
  140. -- low flags: 00
  141. -- high flags: 8003
  142. -- rect: left=281 top=54 right=76 bottom=450
  143. -- title width / last selected line: 0
  144. -- icon id / first selected line: 0 / 0
  145. -- text alignment: 1
  146. -- font id: 0
  147. -- text size: 12
  148. -- style flags: 0
  149. -- line height: 16
  150. -- part name: Enter items into list
  151. ----- HyperTalk script -----
  152. on mouseUp
  153.   ask "What do you want to put in the list?"
  154.   put it into ThisItem
  155.   if it is empty then exit mouseUp
  156.  
  157.   put the number of lines of card field ID 1 into TotalLines
  158.  
  159.   answer "On what line do you want to put it?" with "Line #" or "end of list"
  160.   if it is "Line #" then
  161.     ask "Enter the line number"
  162.     put it into ThisLine
  163.     if it is empty then exit mouseUp
  164.     put ThisItem & Return before line ThisLine of card field ID 1
  165.   else
  166.     put ThisItem & Return after line TotalLines of card field ID 1
  167.   end if
  168.  
  169. end mouseUp
  170.  
  171.  
  172.  
  173. -- part 5 (button)
  174. -- low flags: 00
  175. -- high flags: 8003
  176. -- rect: left=281 top=28 right=50 bottom=450
  177. -- title width / last selected line: 0
  178. -- icon id / first selected line: 0 / 0
  179. -- text alignment: 1
  180. -- font id: 0
  181. -- text size: 12
  182. -- style flags: 0
  183. -- line height: 16
  184. -- part name: List is LOCKED
  185. ----- HyperTalk script -----
  186. on mouseUp
  187.   put the name of the target into ThisName
  188.  
  189.   if locktext of card field ID 1 is true then
  190.     set locktext of card field ID 1 to false
  191.     set the hilite of ThisName to True
  192.     set the name of ThisName to "List is UN-LOCKED"
  193.   else
  194.     set locktext of card field ID 1 to true
  195.     set the hilite of ThisName to false
  196.     set the name of ThisName to "List is LOCKED"
  197.   end if
  198.  
  199. end mouseUp
  200.  
  201.  
  202.  
  203. -- part 6 (button)
  204. -- low flags: 00
  205. -- high flags: 8003
  206. -- rect: left=281 top=269 right=291 bottom=381
  207. -- title width / last selected line: 0
  208. -- icon id / first selected line: 0 / 0
  209. -- text alignment: 1
  210. -- font id: 0
  211. -- text size: 12
  212. -- style flags: 0
  213. -- line height: 16
  214. -- part name: Sort List
  215. ----- HyperTalk script -----
  216. on copyright
  217.  
  218.   -- Super Delete, Copyright by Mac Help Co., January 1988
  219.   -- by Chris Hostetter, Mac Help Co., 1800 East Market Street
  220.   -- Long Beach, CA  90805, (213) 428-7414
  221.   --      The script for this button is copyrighted and may not be
  222.   --      used without the written permission of the author (above).
  223.  
  224. end copyright
  225.  
  226.  
  227. on mouseUp
  228.   Global TrapFieldName
  229.   -- Uses the script "on MouseWithin" located in the script of the stack
  230.   set the loc of the message box to 20,300
  231.   put "MOVE pointer inside field list to Sort then press" && "COMMAND KEY down."
  232.   put "Sort List" into TrapFieldName
  233.   put empty into LastField
  234. end mouseUp
  235.  
  236.  
  237. -- part 7 (field)
  238. -- low flags: 01
  239. -- high flags: 0004
  240. -- rect: left=440 top=24 right=39 bottom=500
  241. -- title width / last selected line: 0
  242. -- icon id / first selected line: 0 / 0
  243. -- text alignment: 1
  244. -- font id: 3
  245. -- text size: 9
  246. -- style flags: 0
  247. -- line height: 12
  248. -- part name: See Script
  249. ----- HyperTalk script -----
  250. on mouseUp
  251.   edit script of card button ID 5
  252. end mouseUp
  253.  
  254.  
  255. -- part 8 (field)
  256. -- low flags: 01
  257. -- high flags: 0004
  258. -- rect: left=439 top=51 right=66 bottom=499
  259. -- title width / last selected line: 0
  260. -- icon id / first selected line: 0 / 0
  261. -- text alignment: 1
  262. -- font id: 3
  263. -- text size: 9
  264. -- style flags: 0
  265. -- line height: 12
  266. -- part name: See Script
  267. ----- HyperTalk script -----
  268. on mouseUp
  269.   edit script of card button ID 4
  270. end mouseUp
  271.  
  272.  
  273. -- part 9 (field)
  274. -- low flags: 01
  275. -- high flags: 0004
  276. -- rect: left=452 top=70 right=85 bottom=512
  277. -- title width / last selected line: 0
  278. -- icon id / first selected line: 0 / 0
  279. -- text alignment: 1
  280. -- font id: 3
  281. -- text size: 9
  282. -- style flags: 0
  283. -- line height: 12
  284. -- part name: See Script
  285. ----- HyperTalk script -----
  286. on mouseUp
  287.   edit script of card field "Item Select"
  288. end mouseUp
  289.  
  290.  
  291. -- part 10 (field)
  292. -- low flags: 01
  293. -- high flags: 0004
  294. -- rect: left=374 top=267 right=282 bottom=434
  295. -- title width / last selected line: 0
  296. -- icon id / first selected line: 0 / 0
  297. -- text alignment: 1
  298. -- font id: 3
  299. -- text size: 9
  300. -- style flags: 0
  301. -- line height: 12
  302. -- part name: See Script
  303. ----- HyperTalk script -----
  304. on mouseUp
  305.   edit script of card Button "Sort List"
  306. end mouseUp
  307.  
  308.  
  309. -- part contents for background part 8
  310. ----- text -----
  311. Card 12 of 20
  312.  
  313. -- part contents for background part 9
  314. ----- text -----
  315. ITEM SELECT
  316. This field allows you to select any item in the list by simply clicking on the item.  
  317. The item will be put in the global variable called 'THISITEM'
  318.  
  319. This field works well both as a scrolling field, or as a rectangle field (or any type of field. )  It must be locked for it to work.  You could temporarily unlock the field to type in it, or you could use commands (click on the button 'Enter items into list') to insert items into the list.
  320. You can make a transparent button titled HILIGHTER, and it will automatically position itself of the selected field for visual feedback.
  321.  
  322.  
  323. SORT LIST
  324. The script of the sort list button is located in the stack scripts section (see on SortList).  It will remove every blank line in a field, and then sort every remaining line in the field.  The field name should be put into the global variable LASTFIELD. 
  325.  
  326. -- part contents for card part 1
  327. ----- text -----
  328. An Apple a Day
  329. 3
  330. 2
  331. The Rain in Spain
  332. 5
  333. 1
  334.  
  335.  
  336. -- part contents for card part 7
  337. ----- text -----
  338. See Script
  339.  
  340. -- part contents for card part 8
  341. ----- text -----
  342. See Script
  343.  
  344. -- part contents for card part 9
  345. ----- text -----
  346. See Script
  347.  
  348. -- part contents for card part 10
  349. ----- text -----
  350. See Script